package book;

public class BookList extends Book {
  private   Book [] book1=new Book[10];
   private int count;
    public BookList(String name,int p,String au,String type,int count,String borrow){
        super(name,p,au,type,borrow);
        this.book1[0]=new Book("自卑与超越",19,"阿德勒","心理学","未借出");
        this.book1[1]=new Book("在人间",15,"高尔基","记叙文","未借出");
        this.book1[2]=new Book("三国演义",17,"罗贯中","小说","未借出");
        this.count=3;
    }

    public void setBook1(Book book1,int i) {    //  添加新图书时需要传入新书（对象的引用变量【含地址】）与此书下标，删除时便于传入后一个下标，且把
        //后一个对象引用（存了后一个对象的地址）赋给前一个对象元素（数组里的对象元素本质是地址）
        this.book1[i] = book1;
    }
    public Book getBook1(int i) {
        return book1[i];//返回的是单个对象元素方便遍历
    }
    public void setCount(int count) {

        this.count = count;
    }
    public int getCount() {
        return count;
    }


}
